package www.tshu.servlet;

import www.tshu.pojo.PI;
import www.tshu.service.impl.UserServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/ServletSelectUserInfo")
public class ServletSelectUserInfo extends HttpServlet {
    private UserServiceImpl userServiceImpl = new UserServiceImpl();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String unum=(String) req.getSession().getAttribute("unum");
        List<PI> plist = userServiceImpl.findUser(unum);
        req.setAttribute("plist",plist);
        req.getRequestDispatcher("user/editUserInfo.jsp").forward(req,resp);
    }
}
